/**
 * @(#)HttpClientUtil.java 2016年11月2日
 * Copyright(C) 2015 ZHEXIN IT CO.,LTD. All rights reserved.
 */
package org.jsbd.boss.httpclient;

import java.io.IOException;

import org.jsbd.boss.httpclient.vo.Request;
import org.jsbd.boss.httpclient.vo.Response;
import org.jsbd.boss.httpclient.vo.XmlOrJsonRequest;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * http工具类
 * 
 * @author <a href="mailto:xupengcheng@zhexinit.com" >徐鹏程</a>
 * @version 1.0.0
 */
public class HttpClientUtil {
	public static final Logger LOGGER = LoggerFactory.getLogger(HttpClientUtil.class);

	/**
	 * 
	 * doGet:get请求
	 * 
	 * @author <a href="mailto:xupengcheng@zhexinit.com" >徐鹏程</a>
	 * @param request
	 * @return
	 */
	public static Response doGet(Request request) {
		HttpGetCaller caller = new HttpGetCaller(request);
		return caller.doGet();
	}

	/**
	 * 
	 * doPost:doPost
	 * 
	 * @author <a href="mailto:xupengcheng@zhexinit.com" >徐鹏程</a>
	 * @param request
	 * @return
	 * @throws IOException
	 */
	public static Response doPost(Request request) {
		HttpPostCaller caller = new HttpPostCaller(request);
		return caller.doPost();
	}

	public static Response doPostXmlOrJSON(XmlOrJsonRequest xmlOrJsonRequest) {
		HttpPostCaller caller = new HttpPostCaller(xmlOrJsonRequest);
		return caller.doPostXmlOrJSON();
	}

}
